<?php

namespace App\Http\Controllers;


use App\Business\File\ImageUpload;
use App\Business\File\GetBiz_YBJ_JSSB_FilesList;
use App\Business\File\GetJSSBFile;
use App\Business\File\JSSBUploadFile;

class FileController extends Controller
{

    public function JSSBUploadFile()
    {
        $business=new JSSBUploadFile();
        return $business->Excute();

    }


    public function ImageUpload()
    {
        $business=new ImageUpload();
        return $business->Excute();

    }



    public function GetJSSBFileList()
    {
        $business=new GetBiz_YBJ_JSSB_FilesList();;
        return $business->Excute();
    }


    public function DownloadJSSBFile(){

        //$parameters=json_decode(urldecode(request()->getContent()));

        $business=new GetJSSBFile();
        $business->ID=request()->get("id");

        $result=$business->Excute(false);
        if($result->result){
            if($result->data) {
                return response()->download(trim($result->data["URLPath"],"/"),
                    $result->data["FileName"]);
            }

        }else
        {
            return json_encode($result);
        }

    }


}